#ifndef __Mutexion__
#define __Mutexion__

#include <pthread.h>
#include <iostream> // 包含 Condition.h 头文件
#include <queue> // 添加 <queue> 头文件
using std::endl;
using std::cout;
class Mutexion
{
public:
    Mutexion();
    ~Mutexion();
    void lock();
    void trylock();
    void unlock();
    pthread_mutex_t *getMutex();

private:
    pthread_mutex_t _mutex;
};

class MutexLockGuard
{
public:
    //在构造函数中初始化资源
    MutexLockGuard(Mutexion &mutex)
    : _mutex(mutex)
    {
        _mutex.lock();
    }

    //在析构函数中释放资源
    ~MutexLockGuard()
    {
        _mutex.unlock();
    }

private:
    Mutexion &_mutex;
};
#endif